home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / terminal / top_152 / src152.exe / rar / TOPIO.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-16  |  47KB  |  1,625 lines

  1. {┌─────────────────────────────────────────────────────────────────────────┐}
  2. {│                                                                         │}
  3. {│                              T. O. P.                                   │}
  4. {│                                                                         │}
  5. {│                        (T)he  (O)ther  (P)acket                         │}
  6. {│                                                                         │}
  7. {│ T O P I O . P A S                                                       │}
  8. {│                                                                         │}
  9. {│                                                                         │}
  10. {│                                                                         │}
  11. {│ Verschiedene Routinen zum Ansprechen des TNC                            │}
  12. {└─────────────────────────────────────────────────────────────────────────┘}
  13.  
  14.  
  15. (*   Eine HOSTMODE-Zeile an den TNC senden
  16.      Format:   SendTNC(KanalNummer,Art(0=Text,1=Kommando),String)     *)
  17.  
  18. Procedure SendTNC (* Var Kanal : Byt; ,Art : Byte; Zeile : String) *);
  19. var   Laenge  : char;
  20.       Channel : char;
  21.       V24Nr   : Byte;
  22.       ch      : Char;
  23. Begin
  24.   if Pseudo then
  25.   begin
  26.     Channel := chr(Kanal);
  27.     Kanal := 0;
  28.   end else Channel := K[Kanal]^.TNCKanal;
  29.  
  30.   V24Nr := V24(Kanal);
  31.  
  32.   ClearV24Buffer;
  33.   FillChar(K[Kanal]^.Response,SizeOf(K[Kanal]^.Response),0);
  34.  
  35.   if TNC[K[Kanal]^.TncNummer]^.TNC_im_Host then
  36.   begin
  37.     Laenge := chr(length(Zeile)-1);
  38.     Switch_TNC(K[Kanal]^.TncNummer);
  39.     IRQsLock;
  40.     WriteAux(V24Nr,Channel + chr(Art) + Laenge);
  41.     WriteAux(V24Nr,Zeile);
  42.   end;
  43. End;
  44.  
  45. Procedure TNCs_Pollen;
  46. Begin
  47.   if not TNC_Halt then
  48.   begin
  49.     inc(Poll);
  50.     if Poll > TNC[PollTNr]^.Kbis then
  51.     begin
  52.       inc(PollTNr);
  53.       if not TNC_used[PollTNr] then PollTNr := 1;
  54.       Poll := TNC[PollTNr]^.Kvon;
  55.       K[0]^.TncNummer := PollTNr;
  56.       Kanal_Pollen(0);
  57.     end;
  58.     if Poll > 0 then with K[Poll]^ do
  59.     begin
  60.       if C_Poll or Test or Ext_Poll or Kanal_benutz or not TNC_ReadOut then
  61.       begin
  62.         Kanal_Pollen(Poll);
  63.       end else
  64.       if not TNC[TncNummer]^.ExtHost then
  65.       begin
  66.         if Pause = PollRate then Kanal_Pollen(Poll);
  67.         inc(Pause);
  68.         if Pause > PollRate then Pause := 0;
  69.       end;
  70.     end;
  71.   end;
  72. End;
  73.  
  74. Procedure Kanal_Pollen (* Kanal : Byte *);
  75. Var  i,i1    : Byte;
  76.      VC      : Char;
  77.      Puffer  : Word;
  78.      SFrame  : Byte;
  79. Begin
  80.   with K[Kanal]^ do
  81.   Begin
  82.     if (Kanal = 0) and TNC[TncNummer]^.ExtHost then
  83.     begin
  84.       Pseudo := true;
  85.       Ausgabe := false;
  86.       TxRxTNC(FF,1,'G');
  87.       if Idle and (Response > '') then
  88.       begin
  89.         Idle_TCount := Idle_Tout;
  90.         Idle_TMerk := TimerTick;
  91.       end;
  92.       for i := 1 to Ord(Response[0]) do
  93.       begin
  94.         VC := Chr(Byte(Ord(Response[i])-1));
  95.         for i1 := TNC[TncNummer]^.Kvon to TNC[TncNummer]^.Kbis do
  96.          if K[i1]^.TNCKanal = VC then K[i1]^.Ext_Poll := true;
  97.       end;
  98.     end;
  99.     Ext_Poll := false;
  100.  
  101.     Get_Linkstatus(Kanal);
  102.  
  103.     if Kanal = 0 then
  104.     begin
  105.       Puffer := FreiePuffer(Kanal);
  106.       for i1 := TNC[TncNummer]^.Kvon to TNC[TncNummer]^.Kbis do
  107.           K[i1]^.BufToLow := Puffer < maxTncBuf;
  108.  
  109.       if (not K[show]^.BufExists or Test) and
  110.          (((show = 0) and (Unproto = TncNummer)) or
  111.           ((show > 0) and (TncNummer = K[show]^.TncNummer))) then
  112.          StatusOut(show,6,4,Attrib[9],SFillStr(5,B1,'»'+int_str(Puffer)));
  113.     end;
  114.  
  115.     if not TNC_ReadOut then
  116.     begin
  117.       While L_Status[1] + L_Status[2] > 0 do
  118.       begin
  119.         S_PAC(Kanal,CM,true,'G');
  120.         Get_Linkstatus(Kanal);
  121.       end;
  122.     end else
  123.     begin
  124.       TncNix := false;
  125.       Repeat
  126.         S_PAC(Kanal,CM,true,'G');
  127.       Until (not MonCode5 and _KeyPressed) or TncNix;
  128.     end;
  129.  
  130.     if BufExists and (Kanal > 0) then
  131.     begin
  132.       if Test then SendTestBuffer(Kanal) else
  133.       begin
  134.         SFrame := L_Status[3];
  135.         While BufExists and not _KeyPressed and
  136.               ((MaxFrame > SFrame) or
  137.                (TNC_Puffer and (FreiePuffer(Kanal) > minTncBuf))) do
  138.         begin
  139.           SendBuffer(Kanal);
  140.           inc(SFrame);
  141.         end;
  142.       end;
  143.     end;
  144.  
  145.     if FileSend and not FileSendWait then
  146.     Begin
  147.       if not BufExists and TNC_Puffer and (TX_Bin <> 2) then
  148.       Repeat
  149.         Puffer := FreiePuffer(Kanal);
  150.         if (Puffer > minTncBuf) then if FileSend then Send_File(Kanal,true);
  151.       Until (Puffer <= minTncBuf) or _KeyPressed or not FileSend
  152.       else begin
  153.         SFrame := L_Status[3];
  154.         While FileSend and not _KeyPressed and
  155.               (Upload or (MaxFrame > SFrame) or WishBuf) do
  156.         begin
  157.           Send_File(Kanal,true);
  158.           inc(SFrame);
  159.         end;
  160.       end;
  161.     end;
  162.  
  163.     if not TNC_ReadOut and (Kanal = maxLink) then TNC_ReadOut := true;
  164.   end; (* WITH ... *)
  165. End;
  166.  
  167. Procedure Get_Linkstatus (* Kanal : Byte *);
  168. Var   Pstr : String[10];
  169.       Attr,
  170.       i,i1 : Byte;
  171. Begin
  172.   with K[Kanal]^ do
  173.   begin
  174.     if Kanal = 0 then i1 := 2 else i1 := 6;
  175.     Ausgabe := false;
  176.     S_PAC(Kanal,CM,true,'L');
  177.  
  178.     for i := 1 to i1 do L_Status[i] := Byte(str_int(ParmStr(i,B1,Response)));
  179.  
  180.     if Kanal > 0 then
  181.     begin
  182.       Pstr := SFillStr(3,B1,int_str(L_Status[3])) +   { Send_Frames           }
  183.               SFillStr(2,B1,int_str(L_Status[4])) +   { Schon gesendet Frames }
  184.               SFillStr(3,B1,int_str(L_Status[5]));    { Tries                 }
  185.       StatusOut(Kanal,13,1,Attrib[9],PStr);
  186.  
  187.       if TxBeepAck and FlagTxBeep and (L_Status[3] = 0) and (L_Status[4] = 0) then
  188.       begin
  189.         if Klingel then Beep(G^.TxPiepFreq,G^.TxPiepTime);
  190.         FlagTxBeep := false;
  191.       end;
  192.       if TxBeepAck and ((L_Status[3] > 0) or (L_Status[4] > 0)) then FlagTxBeep := true;
  193.  
  194.       Attr := Attrib[13];
  195.       if L_Status[6] in [1,7..15] then Attr := Attrib[7];
  196.       StatusOut(Kanal,2,4,Attr,LinkStatus[L_Status[6]]);
  197.       C_Poll := L_Status[6] > 0;
  198.     end;
  199.  
  200.   end;
  201. End;
  202.  
  203. (* Tastatur solange abfragen, bis kein Zeichen mehr kommt *)
  204. Procedure Check_Keyboard;
  205. var     SK   : Sondertaste;
  206.         VC   : char;
  207.          i   : Byte;
  208.  
  209.   Procedure Tasten;
  210.   begin
  211.     KeyCheck := true;
  212.     _ReadKey(SK,VC);
  213.     KeyCheck := false;
  214.     if not ScreenSTBY then
  215.     begin
  216.       polling := false;
  217.       PollTime := TimerTick + KeyDelay;
  218.       Key_Active(show,SK,VC);
  219.     end else Neu_Bild;
  220.     if ScreenInit > 0 then ScreenTimer := ScreenInit;
  221.   end;
  222.  
  223. Begin
  224.   if not ch_aus then
  225.   begin
  226.     for i := 1 to maxLink do with K[i]^ do
  227.     begin
  228.       if RunEscFlag then ReadRunEsc(i);
  229.       if CSelf = 10 then
  230.       begin
  231.         AutoZaehl := AutoToAnzJmp;
  232.         CSelf := 3;
  233.       end;
  234.       if CSelf in [3,9] then Autozeile_Holen(i);
  235.     end;
  236.     if G^.Makro then While G^.Makro do Tasten
  237.                 else While _KeyPressed do Tasten;
  238.   end else
  239.   begin
  240.     ch_aus := false;
  241.     Key_Active(show,SK_out,VC_out);
  242.   end;
  243.   if not polling then if TimerTick > PollTime then polling := true;
  244. End;
  245.  
  246. Procedure Rufz_TNC_init (* Kanal : Byte *);
  247. Begin
  248.   if Kanal > 0 then with K[Kanal]^ do
  249.   begin
  250.     if Test or Mo.MonActive or (Kanal = ConvHilfsPort) then
  251.       S_PAC(Kanal,CM,true,'I' + B1 + PhantasieCall) else
  252.     if not (connected or Kanal_benutz) then
  253.     begin
  254.       S_PAC(Kanal,CM,true,'I' + B1 + OwnCall);
  255.       StatusOut(Kanal,4,1,Attrib[9],EFillStr(9,B1,OwnCall));
  256.       StatusOut(Kanal,2,2,Attrib[9],ConstStr(B1,19));
  257.     end;
  258.   end;
  259. End;
  260.  
  261. Procedure MH_Check (* TNC_Nr : Byte; Zeile : Str128 *);
  262. Var   i,
  263.       AnzDig   : Byte;
  264.       FrUI,
  265.       FrRej,
  266.       DirDig   : Boolean;
  267.       Rufz     : String[9];
  268.       LongDig  : String[70];
  269.  
  270.   Procedure MH_Update(TNC_Nr : Byte);
  271.   var   Stelle : Byte;
  272.         found  : Boolean;
  273.         i      : Byte;
  274.   Begin
  275.     if (G^.QRG_Anz > 0) and (AnzDig = 0) then
  276.     begin
  277.       i := 0;
  278.       Repeat
  279.         inc(i);
  280.         found := (Rufz = G^.QRG[i].Call);
  281.       Until found or (i = G^.QRG_Anz);
  282.       if found then
  283.       begin
  284.         with TNC[TNC_Nr]^ do if QRG_Akt <> G^.QRG[i].QRG then
  285.         begin
  286.           QRG_Akt := G^.QRG[i].QRG;
  287.           Status2;
  288.           TicStr := ConstStr(B1,TL);
  289.         end;
  290.       end;
  291.     end;
  292.  
  293.     Stelle := 0;
  294.     Repeat
  295.       inc(Stelle);
  296.       found := (RufZ = MH^[Stelle].Call) and (TNC_Nr = MH^[Stelle].TNr);
  297.     Until found or (Stelle = maxMH);
  298.  
  299.     if not found then
  300.     begin
  301.       { for i := maxMH-1 downto 1 do MH^[i+1] := MH^[i]; }
  302.       move(MH^[1],MH^[2],(maxMH-1) * SizeOf(MH_Typ));
  303.       Stelle := 1;
  304.       FillChar(MH^[Stelle],SizeOf(MH_Typ),0);
  305.     end;
  306.  
  307.     with MH^[Stelle] do
  308.     begin
  309.       Call := RufZ;
  310.       Zeit := copy(Datum,4,8) + B1 + copy(Uhrzeit,1,5);
  311.       Link := LongDig;
  312.       Qrg  := TNC[TNC_Nr]^.QRG_Akt;
  313.       TNr  := TNC_Nr;
  314.       if FrRej then inc(Rej);
  315.       if FrUI then inc(UIs);
  316.     end;
  317.  
  318.     if (TicAnz > 0) and (LongDig = '') then with TNC[TNC_Nr]^ do if Tic then
  319.     begin
  320.       i := pos(Rufz + B1,TicStr + B1);
  321.       if i > 0 then
  322.       begin
  323.         While TicStr[i] <> B1 do delete(TicStr,i,1);
  324.         delete(TicStr,i,1);
  325.       end else
  326.       begin
  327.         i := length(Rufz) + 1;
  328.         delete(TicStr,Byte(TL+1-i),i);
  329.       end;
  330.       TicStr := Rufz + B1 + TicStr;
  331.       i := TL;
  332.       While (i > 0) and (TicStr[i] <> B1) do
  333.       begin
  334.         TicStr[i] := B1;
  335.         dec(i);
  336.       end;
  337.       if show = 0 then TickerOut;
  338.     end;
  339.   End;
  340.  
  341. Begin
  342.   LongDig := '';
  343.   AnzDig := 0;
  344.   DirDig := false;
  345.   Zeile := RestStr(Zeile);
  346.   Rufz := CutStr(Zeile);
  347.   FrRej := pos(' ctl REJ',Zeile) > 0;
  348.   FrUI := pos(' ctl UI',Zeile) > 0;
  349.   i := pos(' ctl ',Zeile);
  350.   Zeile := copy(Zeile,1,i-1);
  351.  
  352.   i := pos('*',Zeile);
  353.   if i > 0 then
  354.   begin
  355.     DirDig := true;
  356.     Zeile := copy(Zeile,1,i-1);
  357.     delete(Zeile,1,pos(' via ',Zeile)+4);
  358.  
  359.     While pos(B1,Zeile) > 0 do
  360.     begin
  361.       LongDig := B1 + CutStr(Zeile) + LongDig;
  362.       Zeile := RestStr(Zeile);
  363.       inc(AnzDig);
  364.     end;
  365.     LongDig := CutStr(Zeile) + LongDig;
  366.     inc(AnzDig);
  367.   end;
  368.  
  369.  
  370.   MH_Update(TNC_Nr);
  371.  
  372.   if DirDig then
  373.   begin
  374.     Rufz := CutStr(LongDig);
  375.     LongDig := '';
  376.     AnzDig := 0;
  377.     FrRej := false;
  378.     FrUI := false;
  379.     MH_Update(TNC_Nr);
  380.   end;
  381. End;
  382.  
  383.  
  384. Procedure Screen_aus (* Art : Byte *);
  385. Var              i : Byte;
  386. Begin
  387.   if not ScreenSTBY then
  388.   Begin
  389.     if (show > 0) and not BackScroll(show) then
  390.     Begin
  391.       case Art of
  392.         1 : dec(ScreenTimer);
  393.         2 : ScreenTimer := 0;
  394.       end;
  395.       if ScreenTimer = 0 then
  396.       begin
  397.         Teil_Bild_Loesch(1,maxZ,0);
  398.         ScreenSTBY := true;
  399.       end;
  400.     End else if Art = 2 then Alarm;
  401.   End;
  402. End;
  403.  
  404.  
  405. Procedure Uhr_aus;
  406. Var    Zeit : String[8];
  407.        Zstr : String[5];
  408.        Tstr : String[5];
  409.        i    : Byte;
  410. Begin
  411.   Zeit := Uhrzeit;
  412.   if copy(Zeit,7,2) <> copy(ZeitMerk,7,2) then
  413.   begin
  414.     StatusOut(show,13,4,Attrib[10],Zeit);
  415.     if ScreenSTBY then ScreenFill;
  416.     if NowFenster and (Box_Time > 0) then
  417.     begin
  418.       BoxZaehl := Pred(BoxZaehl);
  419.       if BoxZaehl <= 0 then Neu_Bild;
  420.     end;
  421.     if HardCur then if not JumpRxScr then
  422.     begin
  423.       JumpRxZaehl := pred(JumpRxZaehl);
  424.       if JumpRxZaehl <= 0 then JumpRxScr := true;
  425.     end;
  426.     for i := 1 to maxLink do if K[i]^.CSelf = 4 then
  427.     begin
  428.       dec(K[i]^.AutoWait);
  429.       if K[i]^.AutoWait = 0 then K[i]^.CSelf := 3;
  430.     end;
  431.  
  432.     if copy(Zeit,4,2) <> copy(ZeitMerk,4,2) then
  433.     Begin
  434.       inc(LaufZeit);
  435.  
  436.       for i := 1 to TNC_Anzahl do with TNC[i]^ do if Bake then
  437.       begin
  438.         if (LaufZeit mod BTimer) = 0 then
  439.         begin
  440.           K[0]^.TncNummer := i;
  441.           S_PAC(0,CM,true,'C' + B1 + BPfad);
  442.           S_PAC(0,NU,true,BText);
  443.         end;
  444.         if show = 0 then Unproto_darstellen;
  445.       end;
  446.  
  447.       for i := 1 to maxLink do with K[i]^do
  448.       begin
  449.         if CSelf = 1 then if AutoTime = copy(Zeit,1,5) then CSelf := 3;
  450.         if CSelf = 2 then
  451.         begin
  452.           inc(AutoZyCount);
  453.           if AutoZyCount >= AutoZyConst then CSelf := 3;
  454.         end;
  455.         if CSelf = 3 then AutoToAnz := AutoToMax;
  456.         if (CSelf in [5,6]) and (AutoToCount > 0) then
  457.         begin
  458.           dec(AutoToCount);
  459.           if AutoToCount = 0 then
  460.           begin
  461.             CSelf := 9;
  462.             if AutoToAnz > 0 then
  463.             begin
  464.               dec(AutoToAnz);
  465.               if AutoToAnz = 0 then CSelf := 10;
  466.             end;
  467.           end;
  468.         end;
  469.  
  470.         if Hold and not (FileSend or Einstiegskanal or AusstiegsKanal)
  471.                 and ((LaufZeit mod HoldTime) = 0) then
  472.         begin
  473.           S_PAC(i,NU,true,HoldStr);
  474.           if not HardCur then InfoOut(i,0,1,HoldStr);
  475.         end;
  476.       end;
  477.  
  478.       Tstr := copy(RestStr(Datum),1,5);
  479.       Zstr := copy(Zeit,1,5);
  480.  
  481.       for i := 1 to G^.MAK_Anz do
  482.       begin
  483.         if G^.MAK[i].Uhr = Zstr then
  484.         begin
  485.           if (G^.MAK[i].Tag = '') or (G^.MAK[i].Tag = Tstr) then
  486.           begin
  487.             MakroInit;
  488.             Makro_Aktivieren(G^.MAK[i].Name);
  489.           end;
  490.         end;
  491.       end;
  492.  
  493.       if ScreenInit > 0 then Screen_aus(1);
  494.     end;
  495.     ZeitMerk := Zeit;
  496.   end;
  497. End;
  498.  
  499.  
  500. (* TNC-Nachricht abholen und auswerten. Nur nach einem SendTNC ansprechen !!!  *)
  501. Procedure GetTNC (* Kanal : Byte *);
  502. var   i,i1,i2,
  503.       iz,ix,
  504.       Attr,
  505.       TNC_Nr    : Byte;
  506.       Flag      : Boolean;
  507.       Datei     : Text;
  508.       Bstr      : String;
  509.       Dummy     : String;
  510.       IdStr     : String[5];
  511.       BinFrame  : Boolean;
  512.  
  513.    
  514.    Procedure Port_Ident(Kanal : Byte; var Col : Byte);
  515.    var     HfPort,i : Byte;
  516.            flag     : Boolean;
  517.    Begin
  518.      with K[Kanal]^ do
  519.      begin
  520.        i := pos(DP,Response);
  521.        if i > 0 then
  522.        begin
  523.          HfPort := str_int(Response[i-1]);
  524.          delete(Response,i-1,2);
  525.          KillStartBlanks(Response);
  526.          i := 1;
  527.          flag := false;
  528.          Repeat
  529.            if (TNC[i]^.DRSI = TNC[K[Kanal]^.TncNummer]^.DRSI) and
  530.               (TNC[i]^.HF_Port = HfPort) then flag := true else inc(i);
  531.          Until flag or (i > TNC_Anzahl);
  532.          if flag then Col := i
  533.                  else Col := 1;
  534.          IdStr := TNC[Col]^.Ident;
  535.          if length(IdStr) > 0 then IdStr := EFillStr(5,B1,IdStr)
  536.                               else IdStr := '';
  537.        end else
  538.        begin
  539.          IdStr := Channel_Id(Kanal);
  540.          Col := TncNummer;
  541.        end;
  542.      end;
  543.    End;
  544.  
  545. Begin
  546.   if TNC[K[Kanal]^.TncNummer]^.TNC_im_Host then with K[Kanal]^ do
  547.   begin
  548.     TNC_Nr := V24(Kanal);
  549.  
  550.     get_Response(Kanal);
  551.  
  552.     If not (OverRun or SynchError) then
  553.     Case TNC_Code of
  554.        0 : Begin  (* success, no info *)
  555.              Response := '';
  556.              Ausgabe := true;
  557.              TncNix := true;
  558.            End;
  559.        1 : Begin  (* success with info (null-terminated) *)
  560.              if TNC[TncNummer]^.DRSI > 0 then Port_ident(Kanal,ix)
  561.                                          else IdStr := Channel_Id(Kanal);
  562.              if Ausgabe then
  563.              begin
  564.                if TNC_ReadOut then InfoOut(Kanal,0,1,IdStr + Response)
  565.                               else M_aus(Attrib[28],IdStr + Response +^J);
  566.              end;
  567.              Ausgabe := true;
  568.            End;
  569.        2 : Begin  (* failure with info (null-terminated) *)
  570.              if Ausgabe then InfoOut(Kanal,1,1,Channel_Id(Kanal) + Response);
  571.              Ausgabe := true;
  572.            End;
  573.        3 : Begin    (* Link Status (null-terminated) *)
  574.              if TNC[TncNummer]^.DRSI > 0 then Port_ident(Kanal,ix)
  575.                                          else IdStr := Channel_Id(Kanal);
  576.  
  577.              If pos(LSM[1],Response) > 0 then
  578.              Begin  (* BUSY fm ... *)
  579.                delete(Response,1,12);
  580.                Response := BusyStr + Response;
  581.                _aus(Attrib[20],Kanal,Response + M1);
  582.                Kanal_benutz := false;
  583.                if AusstiegsKanal then
  584.                begin
  585.                  S_PAC(GegenKanal,NU,true,M2 + Response + M1);
  586.                  Send_Prompt(GegenKanal,FF);
  587.                  RemConInit(Kanal);
  588.                end;
  589.                Auto_CON := false;
  590.                Rufz_TNC_init(Kanal);
  591.                SetzeFlags(Kanal);
  592.              End else
  593.  
  594.              If pos(LSM[2],Response) > 0 then
  595.              Begin  (* CONNECTED to ... *)
  596.                if not Rekonnekt then
  597.                begin
  598.                  Rekonnekt := false;
  599.                  Kanal_benutz := true;
  600.                  L_ON(Kanal,Response,true,false);
  601.                  Line_ON(Kanal);
  602.                end else InfoOut(Kanal,1,1,'Reconnect to ' + Call);
  603.              End else
  604.  
  605.              If pos(LSM[3],Response) > 0 then
  606.              Begin  (* LINK RESET fm ... *)
  607.                Response := RestStr(Response);
  608.                _aus(Attrib[20],Kanal,Star + Response + M1);
  609.                Kanal_benutz := true;
  610.              End else
  611.  
  612.              If pos(LSM[4],Response) > 0 then
  613.              Begin  (* LINK RESET to ... *)
  614.                Response := RestStr(Response);
  615.                _aus(Attrib[20],Kanal,Star + Response + M1);
  616.                Kanal_benutz := true;
  617.              End else
  618.  
  619.              If pos(LSM[5],Response) > 0 then
  620.              Begin  (* DISCONNECTED *)
  621.                Rekonnekt := false;
  622.                if Conv.Active then ConversQuit(Kanal);
  623.                L_Off(Kanal);
  624.                Rufz_TNC_init(Kanal);
  625.                if EinstiegsKanal then S_PAC(GegenKanal,CM,true,'D');
  626.                if AusstiegsKanal then
  627.                begin
  628.                  if K[GegenKanal]^.RemConReady then
  629.                  begin
  630.                    S_PAC(GegenKanal,NU,false,M2 + ReconStr +
  631.                          K[GegenKanal]^.OwnCall+M2);
  632.                    Send_Prompt(GegenKanal,FF);
  633.                  end;
  634.                  RemConInit(Kanal);
  635.                end;
  636.              End else
  637.  
  638.              If pos(LSM[6],Response) > 0 then
  639.              Begin  (* LINK FAILURE with ... *)
  640.                if Conv.Active then ConversQuit(Kanal);
  641.                if EinstiegsKanal then S_PAC(GegenKanal,CM,true,'D');
  642.                if AusstiegsKanal then
  643.                begin
  644.                  if Auto_Con then S_PAC(GegenKanal,NU,false,M2 + FailStr + Ziel_Call + M1) else
  645.                  begin
  646.                    if connected
  647.                     then S_PAC(GegenKanal,NU,false,M1 + ReconStr + K[GegenKanal]^.OwnCall+M1)
  648.                     else S_PAC(GegenKanal,NU,false,M2 + Star + Response + M1);
  649.                  end;
  650.                  Send_Prompt(GegenKanal,FF);
  651.                  RemConInit(Kanal);
  652.                end;
  653.                L_Off(Kanal);
  654.                Rufz_TNC_init(Kanal);
  655.              End else
  656.  
  657.              If pos(LSM[7],Response) > 0 then
  658.              Begin  (* CONNECT REQUEST fm ... *)
  659.                if Klingel then Beep(600,70);
  660.                InfoOut(show,1,1,Star + IdStr + Response);
  661.              End else
  662.  
  663.              If pos(LSM[8],Response) > 0 then
  664.              Begin  (* FRAME REJECT fm ... *)
  665.                Response := RestStr(Response);
  666.                _aus(Attrib[20],Kanal,Star + Response + M1);
  667.              End else
  668.  
  669.              If pos(LSM[9],Response) > 0 then
  670.              Begin  (* FRAME REJECT to ... *)
  671.                Response := RestStr(Response);
  672.                _aus(Attrib[20],Kanal,Star + Response + M1);
  673.              End else
  674.              Begin (* Unbekannt *)
  675.                _aus(Attrib[20],Kanal,InfoZeile(106) + Response + M1);
  676.              End;
  677.            End;
  678.        4 : Begin  (* Monitor header, no info (null-terminated) *)
  679.              if TNC[TncNummer]^.DRSI > 0 then
  680.              begin
  681.                Port_Ident(0,ix);
  682.                ColMon := ColMonBeg + ix * 3 - 2;
  683.                MH_Check(ix,Response);
  684.              end else
  685.              begin
  686.                ix := TncNummer;
  687.                ColMon := ColMonBeg + ix * 3 - 2;
  688.                IdStr := Channel_Id(0);
  689.                MH_Check(ix,Response);
  690.              end;
  691.  
  692.              TNC_K := (pos(' - ',Response) > 0); (* K auf 2 gesetzt ? *)
  693.  
  694.              if Mon_Anz > 0 then
  695.              begin
  696.                for i := 1 to maxLink do with K[i]^.Mo do
  697.                begin
  698.                  if MonActive and MonDisAbr then
  699.                    if (pos(MonStr[1]+B1,K[0]^.Response) > 0) or
  700.                       (pos(MonStr[2]+B1,K[0]^.Response) > 0) then
  701.                  begin
  702.                    if (pos(' ctl DISC',K[0]^.Response) > 0) or
  703.                       (pos(' ctl DM',K[0]^.Response) > 0) then
  704.                    begin
  705.                      _aus(Attrib[20],i,M1 + InfoZeile(65) + B1 +
  706.                                        RestStr(K[0]^.Response) + M1);
  707.                      Cancel_Call_monitoren(i);
  708.                    end;
  709.                  end;
  710.                end;
  711.              end;
  712.  
  713.              if Drucker then Write_Lpt(0,LptEsc[1]);
  714.              Bstr := FormMonFr(ix,IdStr,Response);
  715.              if (Time_stamp and not TNC_K) then Bstr := Bstr + B1 + '(' + Uhrzeit + ')';
  716.              if not RxLRet then Bstr := ^J + Bstr;
  717.              M_aus(Attrib[ColMon],Bstr + ^J);
  718.              if Drucker then Write_Lpt(0,LptEsc[2]);
  719.            End;
  720.        5 : Begin  (* Monitor header with info (null-terminated) *)
  721.              if TNC[TncNummer]^.DRSI > 0 then
  722.              begin
  723.                Port_Ident(0,ix);
  724.                ColMon := ColMonBeg + ix * 3 - 2;
  725.                MH_Check(ix,Response);
  726.              end else
  727.              begin
  728.                ix := TncNummer;
  729.                ColMon := ColMonBeg + ix * 3 - 2;
  730.                IdStr := Channel_Id(0);
  731.                MH_Check(ix,Response);
  732.              end;
  733.  
  734.              TNC_K := (pos(' - ',Response) > 0); (* K auf 2 gesetzt ? *)
  735.  
  736.              G^.HeaderStr := Response;
  737.  
  738.              if Drucker then Write_Lpt(0,LptEsc[1]);
  739.              Bstr := FormMonFr(ix,IdStr,Response);
  740.              if Time_stamp and not TNC_K then Bstr := Bstr + B1 + '(' + Uhrzeit + ')';
  741.              if not RxLRet then Bstr := ^J + Bstr;
  742.              M_aus(Attrib[ColMon],Bstr);
  743.              if Drucker then Write_Lpt(0,LptEsc[2]);
  744.  
  745.              MonCode5 := true;
  746.            End;
  747.        6 : If MonCode5 then    (* Monitor info (Byte count) *)
  748.            Begin
  749.              MonCode5 := false;
  750.  
  751.              if RxComp then Response := DeCompress(Response);
  752.  
  753.              if PacOut then M_aus(Attrib[ColMon],' (' + int_str(TNC_Count) + ')');
  754.              M_aus(Attrib[ColMon],^J);
  755.              inc(ColMon);
  756.  
  757.              Mon_Header_Auswerten;
  758.  
  759.              if Mon_Anz > 0 then
  760.               for i := 1 to maxLink do with K[i]^.Mo do
  761.                if MonActive and (MonNow[1] or MonNow[2]) then
  762.                begin
  763.                  TNC_Info(i,MonAttr,K[0]^.Response);
  764.                  if K[0]^.TNC_Count > 255
  765.                   then TNC_Info(i,MonAttr,K[0]^.Response256);
  766.                end;
  767.  
  768.              if Drucker then Write_Lpt(Kanal,LptEsc[3]);
  769.  
  770.              BinFrame := false;
  771.              if NoBinMon then
  772.              begin
  773.                i := length(Response);
  774.                Repeat
  775.                  if ord(Response[i]) in [0..5,15..25,27..31,155..224,226..254]
  776.                   then BinFrame := true;
  777.                  dec(i);
  778.                Until BinFrame or (i < 1);
  779.  
  780.                if BinFrame then
  781.                begin
  782.                  Response := '<BIN';
  783.                  if PacOut then Response := Response + RSK +^J
  784.                            else Response := Response + B1 +
  785.                                 int_str(TNC_Count) + RSK +^J;
  786.                end;
  787.              end;
  788.  
  789.              M_aus(Attrib[ColMon],Response);
  790.              if not BinFrame and (TNC_Count > 255) then
  791.                M_aus(Attrib[ColMon],Response256);
  792.  
  793.              if Drucker then Write_Lpt(0,LptEsc[4]);
  794.            End;
  795.  
  796.        7 : Begin (* Connected info (Byte count) *)
  797.              TNC_Info(Kanal,Attrib[18],Response);
  798.              if TNC_Count > 255 then TNC_Info(Kanal,Attrib[18],Response256);
  799.            End;
  800.  
  801.     end;
  802.   End;
  803. End;
  804.  
  805.  
  806. Procedure S_PAC (* Kanal,Art : Byte; All : Boolean; Zeile : String *);
  807. Var  i,l : Byte;
  808.  
  809.   Procedure MakePaclenStr(Zeile : String);
  810.   Begin
  811.     with K[Kanal]^ do
  812.     Repeat
  813.       l := FF - length(SendZeile);
  814.       SendZeile := SendZeile + copy(Zeile,1,l);
  815.       delete(Zeile,1,l);
  816.       While length(SendZeile) >= PacLen do
  817.       begin
  818.         if not BufExists and (Kanal > 0) and (BufToLow or WishBuf or Test) then
  819.         begin
  820.           OpenBufferFile(Kanal);
  821.           SetzeFlags(Kanal);
  822.         end;
  823.         if BufExists then WriteBuffer(Kanal,copy(SendZeile,1,PacLen))
  824.                      else TxRxTNC(Kanal,0,copy(SendZeile,1,PacLen));
  825.  
  826.         delete(SendZeile,1,PacLen);
  827.       end;
  828.     Until Zeile = '';
  829.   End;
  830.  
  831. Begin
  832.   with K[Kanal]^ do
  833.   begin
  834.     if Art = CM then TxRxTNC(Kanal,CM,Zeile) else
  835.     if Art = NU then
  836.     begin
  837.       if Auto_CON then NodeConnect(Kanal,UpCaseStr(Zeile));
  838.       l := Ord(Zeile[0]);
  839.       if l > 0 then TxLRet := Zeile[l] = M1;
  840.  
  841.       if EigFlag or FileFlag or RemFlag then
  842.       begin
  843.         if Drucker then Write_Lpt(Kanal,LptEsc[7]);
  844.         if EigFlag then if not RxLRet then _aus(Attrib[19],Kanal,M1);
  845.         _aus(Attrib[19],Kanal,Zeile);
  846.         if Drucker then Write_Lpt(Kanal,LptEsc[8]);
  847.       end;
  848.  
  849.       if TxComp then
  850.       begin
  851.         Repeat
  852.           i := Ord(Zeile[0]);
  853.           if i > maxCompPac then i := maxCompPac;
  854.           MakePaclenStr(Compress(copy(Zeile,1,i)));
  855.           delete(Zeile,1,i);
  856.         Until Zeile = '';
  857.       end else MakePaclenStr(Zeile);
  858.  
  859.       if All and (length(SendZeile) > 0) then
  860.       begin
  861.         if not BufExists and (Kanal > 0) and (BufToLow or WishBuf or Test) then
  862.         begin
  863.           OpenBufferFile(Kanal);
  864.           SetzeFlags(Kanal);
  865.         end;
  866.         if BufExists then WriteBuffer(Kanal,SendZeile)
  867.                      else TxRxTNC(Kanal,0,SendZeile);
  868.         SendZeile := '';
  869.       end;
  870.  
  871.     end;
  872.   end;
  873. End;
  874.  
  875. Procedure TxRxTNC (* Kanal,Art : Byte; Zeile : String *);
  876. Var   Merk : Boolean;
  877. Begin
  878.   Merk := Ausgabe;
  879.   Ausgabe := false;
  880.  
  881.   if (Kanal = 0) and (TNC[K[0]^.TncNummer]^.DRSI > 0) and
  882.      (K[0]^.TncAkt <> K[0]^.TncNummer) then
  883.   begin
  884.     K[0]^.TncAkt := K[0]^.TncNummer;
  885.     SendTNC(Kanal,1,TNC[K[0]^.TncNummer]^.HF_PortStr);
  886.     GetTNC(Kanal);
  887.   end;
  888.  
  889.   Ausgabe := Merk;
  890.   SendTNC(Kanal,Art,Zeile);
  891.   GetTNC(Kanal);
  892. End;
  893.  
  894.  
  895. (*  Monitor-Status aller angeschlossenen TNCs feststellen und speichern,
  896.     danach alle Monitore abschalten. *)
  897. Procedure Moni_Off (* Art : Byte *);
  898. Var   i : Byte;
  899. Begin
  900.   if MoniStaAnz = 0 then
  901.   begin
  902.     for i := 1 to TNC_Anzahl do with TNC[i]^ do
  903.     begin
  904.       K[0]^.TncNummer := i;
  905.       Ausgabe := false;
  906.       S_PAC(0,CM,true,'M');
  907.       MoniStatus := K[0]^.Response;
  908.     end;
  909.  
  910.     if (Mon_Anz = 0) or (Art = 1) then
  911.      for i := 1 to TNC_Anzahl do with TNC[i]^ do
  912.      begin
  913.        K[0]^.TncNummer := i;
  914.        S_PAC(0,CM,true,'MN');
  915.      end;
  916.   end;
  917.   inc(MoniStaAnz);
  918. End;
  919.  
  920. (* Monitor-Status bei allen TNCs wieder herstellen *)
  921. Procedure Moni_On;
  922. Var    i : Byte;
  923. Begin
  924.   if MoniStaAnz > 0 then dec(MoniStaAnz);
  925.   if MoniStaAnz = 0 then
  926.   begin
  927.     for i := 1 to TNC_Anzahl do with TNC[i]^ do
  928.     begin
  929.       K[0]^.TncNummer := i;
  930.       S_PAC(0,CM,true,'M' + B1 + MoniStatus);
  931.     end;
  932.   end;
  933. End;
  934.  
  935.  
  936. Procedure Check_Mld (* Kanal : Byte; Zeile : Str80 *);
  937. Var   i    : Byte;
  938.       Flag : Boolean;
  939.       Hstr : String[80];
  940. Begin
  941.   with K[Kanal]^ do
  942.   begin
  943.     Zeile := UpCaseStr(Zeile);
  944.     MldOk := 0;
  945.     Flag := false;
  946.  
  947.     i := 0;
  948.     Repeat
  949.       inc(i);
  950.       if (Zeile > '') and
  951.          ((i in [1..3,6,7,24])     and (pos(Meldung[i],Zeile) > 0)) or
  952.          ((i in [4,5,8,9,11..15])  and (pos(Meldung[i],Zeile) = 1)) or
  953.          ((i in [10,16,17,19..23]) and (Meldung[i] = Zeile)) or
  954.          ((i in [18]) and (pos(Meldung[i],Zeile) = 1) and Conv.Active) then
  955.       begin
  956.         MldOk := i;
  957.         Flag := true;
  958.       end;
  959.     Until Flag or (i >= maxMld);
  960.  
  961.     if not Flag and (ExtMld > '') and (pos(ExtMld,Zeile) = 1) then
  962.     begin
  963.       Flag := true;
  964.       ExtMldFlag := true;
  965.     end;
  966.  
  967.     if Flag and Conv.Active and not (MldOk in [6,18]) then Flag := false;
  968.  
  969.     if Flag and RecCheck and (MldOk = 6) then
  970.     begin
  971.       While pos(B1,Zeile) > 0 do Zeile := RestStr(Zeile);
  972.       if pos(DP,Zeile) > 0 then Zeile := ParmStr(2,DP,Zeile);
  973.       Hstr := ACMerk;
  974.       KillEndBlanks(Hstr);
  975.       if pos(RSK + Zeile + B1,Hstr) = 0 then
  976.       begin
  977.         Flag := false;
  978.         MldOk := 0;
  979.       end;
  980.     end;
  981.  
  982.     if not Flag then MldOk := 0;
  983.   end;
  984. End;
  985.  
  986.  
  987. Procedure TNC_Info (* Kanal,Attr : Byte; Zeile : String *);
  988. Var    i : Byte;
  989. Begin
  990.   with K[Kanal]^ do
  991.   begin
  992.     if not RxComp and KillEsc and (Mo.MonActive or SCon[11]) then
  993.     begin
  994.       While pos(E7m,Zeile) > 0 do delete(Zeile,pos(E7m,Zeile),4);
  995.       While pos(E0m,Zeile) > 0 do delete(Zeile,pos(E0m,Zeile),4);
  996.     end;
  997.  
  998.     While Zeile > '' do
  999.     begin
  1000.       i := pos(M1,Zeile);
  1001.       if i > 0 then
  1002.       begin
  1003.         inc(RxLines);
  1004.         MeldeZeile := MeldeZeile + copy(Zeile,1,i-1);
  1005.         Check_Mld(Kanal,MeldeZeile);
  1006.  
  1007.         if RxComp then
  1008.         begin
  1009.           if MldOk in [1,6,22] then
  1010.           begin
  1011.             RxComp := false;
  1012.             TxComp := false;
  1013.             CompZeile := '';
  1014.             MeldeCompZ := '';
  1015.           end else
  1016.           if MldOk = 23 then
  1017.           begin
  1018.             CompZeile := '';
  1019.             MeldeCompZ := '';
  1020.             MldOk := 0;
  1021.             delete(Zeile,1,i);
  1022.           end else MldOk := 0;
  1023.         end;
  1024.  
  1025.         Comp_Sammler(Kanal,Attr,i >= length(Zeile),copy(Zeile,1,i));
  1026.         MldOk := 0;
  1027.         MeldeZeile := '';
  1028.         AutoCheckLn := false;
  1029.         delete(Zeile,1,i);
  1030.       end else
  1031.       begin
  1032.         MeldeZeile := MeldeZeile + Zeile;
  1033.         Comp_Sammler(Kanal,Attr,true,Zeile);
  1034.         Zeile := '';
  1035.       end;
  1036.     end;
  1037.   end;
  1038. End;
  1039.  
  1040.  
  1041. Procedure Comp_Sammler (* Kanal,Attr : Byte; FrEnd : Boolean; Zeile : String *);
  1042. Var    i,i1,
  1043.        i2,l   : Byte;
  1044.        CZeile : String;
  1045. Begin
  1046.   with K[Kanal]^ do if RxComp then
  1047.   begin
  1048.     Repeat
  1049.       i := FF - length(CompZeile);
  1050.       i1 := length(Zeile);
  1051.       if i > i1 then i := i1;
  1052.       CompZeile := CompZeile + copy(Zeile,1,i);
  1053.       delete(Zeile,1,i);
  1054.       i := length(CompZeile);
  1055.       if i > 0 then
  1056.       begin
  1057.         i1 := Ord(CompZeile[1]);
  1058.         if i1 = FF then
  1059.         begin
  1060.           if i > 1 then i1 := Ord(CompZeile[2]);
  1061.           if i1 = FF then i1 := FF-2;
  1062.           dec(i);
  1063.           l := 2;
  1064.         end else l := 1;
  1065.         if i > i1 then
  1066.         begin
  1067.           CZeile := DeCompress(copy(CompZeile,1,i1+l));
  1068.           While CZeile > '' do
  1069.           begin
  1070.             i2 := pos(M1,CZeile);
  1071.             if i2 > 0 then
  1072.             begin
  1073.               MeldeCompZ := MeldeCompZ + copy(CZeile,1,i2-1);
  1074.               Check_Mld(Kanal,MeldeCompZ);
  1075.               Connect_Info(Kanal,Attr,i2 >= length(CZeile),copy(CZeile,1,i2));
  1076.               MldOk := 0;
  1077.               MeldeCompZ := '';
  1078.               AutoCheckLn := false;
  1079.               delete(CZeile,1,i2);
  1080.             end else
  1081.             begin
  1082.               MeldeCompZ := MeldeCompZ + CZeile;
  1083.               Connect_Info(Kanal,Attr,true,CZeile);
  1084.               CZeile := '';
  1085.             end;
  1086.           end;
  1087.           delete(CompZeile,1,i1+l);
  1088.         end;
  1089.       end else i1 := FF;
  1090.     Until (Zeile = '') and (i <= i1);
  1091.   end else Connect_Info(Kanal,Attr,FrEnd,Zeile);
  1092. End;
  1093.  
  1094.  
  1095. Procedure Connect_Info (* Kanal,Attr : Byte; FrEnd : Boolean; Zeile : String *);
  1096. var       i,i1,iz  : Integer;
  1097.           Flag,
  1098.           BFlag,
  1099.           ReKon    : Boolean;
  1100.           Bstr     : String;
  1101.           Rufz     : String[9];
  1102.           MemZeile : String[80];
  1103.  
  1104. Begin
  1105.   with K[Kanal]^ do
  1106.   begin
  1107.     if ScreenSTBY then Neu_Bild;
  1108.     ScreenTimer := ScreenInit;
  1109.  
  1110.     Flag := true;
  1111.     if not Ignore then Flag := false;
  1112.     if RX_Save and (RX_Bin in [2,5]) and (MldOk in [6,10]) then Flag := false;
  1113.     if AusstiegsKanal and (MldOk = 6) then Flag := false;
  1114.     if Flag then MldOk := 0;
  1115.  
  1116.     BFlag := true;
  1117.     if RxComp then MemZeile := MeldeCompZ
  1118.               else MemZeile := MeldeZeile;
  1119.  
  1120.     ReKon := false;
  1121.  
  1122.     if not Ignore and WishBoxLst and (SysArt in SysMenge) and
  1123.        (Zeile[length(Zeile)] = M1) then
  1124.     begin
  1125.       BoxStr := MemZeile;
  1126.       Write_BoxStr(Kanal,0);
  1127.     end;
  1128.  
  1129.     if EinstiegsKanal and not Ignore and not RemConReady then
  1130.     begin
  1131.       i := GegenKanal;
  1132.       RemConInit(i);
  1133.       S_PAC(i,CM,true,'D');
  1134.       S_PAC(i,CM,true,'G');
  1135.       Ausgabe := false;
  1136.       S_PAC(i,CM,true,'D');
  1137.       S_PAC(i,CM,true,'G');
  1138.       if length(MemZeile) = 0 then
  1139.       begin
  1140.         MldOk := 0;
  1141.         Send_Prompt(Kanal,FF);
  1142.       end;
  1143.     end;
  1144.  
  1145.     if AusstiegsKanal and (MldOk = 6) then
  1146.     begin
  1147.       Zeile := '';
  1148.       S_PAC(Kanal,CM,true,'D');
  1149.     end;
  1150.  
  1151.     if RX_Save then
  1152.     begin
  1153.       if not BinOut then BFlag := false;
  1154.       if (RX_Bin = 5) and (MldOk in [6,10]) then
  1155.       begin
  1156.         Write_RxFile(Kanal,MemZeile);
  1157.         BFlag := true;
  1158.       end else
  1159.       begin
  1160.         if RX_Bin = 1 then BFlag := true;
  1161.         Write_RxFile(Kanal,Zeile);
  1162.       end;
  1163.     end else
  1164.     if AutoBinOn and (MldOk = 8) then
  1165.     begin
  1166.       OpenBinFile(Kanal,MemZeile);
  1167.     end else
  1168.     begin
  1169.       if (RX_Bin in [3,4]) and (MldOk in [6,10]) then
  1170.       begin
  1171.         RX_Bin := 0;
  1172.         S_Aus(Kanal,3,M1 + Star + InfoZeile(41) + M1);
  1173.         S_PAC(Kanal,NU,true,'');
  1174.         SetzeFlags(Kanal);
  1175.       end;
  1176.     end;
  1177.  
  1178.     if SPlus and (RX_Bin = 0) then
  1179.     begin
  1180.       if (MldOk = 11) and (length(MemZeile) <> 69) then MldOk := 0;
  1181.       if SplSave and (MldOk in [1,6,10,11,14]) then Close_7Plus(Kanal);
  1182.       if SplSave then
  1183.       begin
  1184.         Write_SplFile(Kanal,Zeile);
  1185.         if not BinOut then BFlag := false;
  1186.       end;
  1187.  
  1188.       if (MldOk in [11,14]) and not SplSave then
  1189.       begin
  1190.         Open_Close_7Plus(Kanal,MemZeile);
  1191.         if SplSave then
  1192.         begin
  1193.           Write_SplFile(Kanal,MemZeile + M1);
  1194.           if not BinOut then BFlag := true;
  1195.         end;
  1196.       end;
  1197.  
  1198.       if SplSave and (MldOk in [12,15]) then
  1199.       begin
  1200.         Open_Close_7Plus(Kanal,MemZeile);
  1201.         if not BinOut then
  1202.         begin
  1203.           Zeile := MemZeile + M1;
  1204.           BFlag := true;
  1205.         end;
  1206.       end;
  1207.     end;
  1208.  
  1209.     if Drucker then Write_Lpt(Kanal,LptEsc[5]);
  1210.  
  1211.     if BFlag then _aus(Attr,Kanal,Zeile);
  1212.  
  1213.     if WeFlag then
  1214.     begin
  1215.       WeFlag := false;
  1216.       _aus(Attrib[20],Kanal,G^.DZeile);
  1217.     end;
  1218.  
  1219.     if WishDXC and (MldOk = 4) and (Mo.MonActive or SCon[11]) then
  1220.     begin
  1221.       Bstr := MemZeile;
  1222.       Compute_QTH(Bstr);
  1223.       if Bstr > '' then _aus(Attrib[29],Kanal,Bstr + M1);
  1224.     end;
  1225.     if Drucker then Write_Lpt(Kanal,LptEsc[6]);
  1226.  
  1227.     if CSelf > 0 then
  1228.     begin
  1229.       if (CSelf = 5) and (Auto1Zeile > '') and not AutoCheckLn and
  1230.          (pos(Auto1Zeile,UpCaseStr(MemZeile)) > 0) then
  1231.       begin
  1232.         AutoCheckLn := true;
  1233.         if AutoArt = 1 then
  1234.         begin
  1235.           Auto1Zeile := '';
  1236.           AutoArt := 2;
  1237.         end else CSelf := 8;
  1238.       end;
  1239.  
  1240.       if (CSelf = 5) and not AutoCheckLn and
  1241.          (pos(AutoZeile,UpCaseStr(MemZeile)) > 0) then
  1242.          begin
  1243.            CSelf := 7;
  1244.            AutoCheckLn := true;
  1245.          end;
  1246.  
  1247.       if (CSelf = 5) and (AutoToCount > 0) then AutoToCount := AutoToConst;
  1248.  
  1249.       if CSelf = 8 then
  1250.       begin
  1251.         Auto1Zeile := '';
  1252.         AutoJmpRet[AutoJmpPtr] := AutoZaehl;
  1253.         inc(AutoJmpPtr);
  1254.         if AutoJmpPtr > maxAutoJmpPtr then AutoJmpPtr := 1;
  1255.         AutoZaehl := AutoJump;
  1256.         CSelf := 7;
  1257.       end;
  1258.       if CSelf = 7 then Autozeile_Holen(Kanal);
  1259.     end;
  1260.  
  1261.     if not Ausstiegskanal then
  1262.     begin
  1263.       if SCon[1] then
  1264.       begin
  1265.         if (RxLines < 10) and (MldOk = 24) then DieBox_PW_Scan(Kanal,MemZeile);
  1266.       end else
  1267.  
  1268.       if SCon[2] then
  1269.       begin
  1270.         if ExtMldFlag then
  1271.         begin
  1272.           if RxLines <= 5 then
  1273.           begin
  1274.             BayBox_US_Scan(Kanal,Zeile);
  1275.             ExtMld := '';
  1276.             ExtMldFlag := false;
  1277.           end else
  1278.           begin
  1279.             ExtMld := '';
  1280.             ExtMldFlag := false;
  1281.           end;
  1282.         end;
  1283.       end;
  1284.     end;
  1285.  
  1286.     if RTF and (MldOk = 5) then ComputeRTF(Kanal,MemZeile);
  1287.  
  1288.     if (Kanal <> show) and
  1289.        not(EinstiegsKanal or AusstiegsKanal or NochNichtGelesen) and
  1290.        (not Conv.Active or (Conv.Active and (Kanal = ConvHilfsPort))) then
  1291.     begin     (* Signalisieren, dass neuer Text gekommen ist *)
  1292.       NochNichtGelesen := true;
  1293.       Status2;
  1294.       If Klingel and TNC_ReadOut and
  1295.          (not Mo.MonActive or (Mo.MonActive and Mo.MonSignal)) then Daten_Bell;
  1296.     end;
  1297.  
  1298.     if Conv.Active then
  1299.     begin
  1300.       if MldOk = 6 then ConversQuit(Kanal);
  1301.       if MldOk = 18 then
  1302.       begin
  1303.         if not FrEnd then ConversTX(Kanal,true,false,'');
  1304.         ConversRemote(Kanal,MemZeile);
  1305.       end else if Zeile <> M1 then
  1306.       begin
  1307.         ConversTX(Kanal,FrEnd,false,Zeile);
  1308.         inc(Conv.Count);
  1309.       end;
  1310.       if FrEnd then Conv.Count := 0;
  1311.     end;
  1312.  
  1313.     if AusstiegsKanal and Auto_CON and (MldOk in [1,2,3,6]) then
  1314.     begin
  1315.       S_PAC(GegenKanal,NU,false,M2 + FailStr + Ziel_Call + M1);
  1316.       Send_Prompt(GegenKanal,FF);
  1317.       S_PAC(Kanal,CM,true,'D');
  1318.       RemConInit(Kanal);
  1319.     end;
  1320.  
  1321.     if not (AusstiegsKanal or EinstiegsKanal) then
  1322.     begin
  1323.       if FileSend and (TX_Bin <> 2) and (MldOk in [6,10]) then
  1324.       begin
  1325.         FiResult := CloseBin(TxFile);
  1326.         FileSend := false;
  1327.         if MldOk = 10 then
  1328.         begin
  1329.           S_Aus(Kanal,3,M1 + Star + InfoZeile(107) + M1);
  1330.           S_PAC(Kanal,NU,true,'');
  1331.         end;
  1332.         SetzeFlags(Kanal);
  1333.       end;
  1334.  
  1335.       ReKon := false;
  1336.  
  1337.       if not Ignore and not Mo.MonActive then
  1338.       begin
  1339.         if MldOk = 6 then
  1340.         begin
  1341.           NodeCmd := true;
  1342.           ReKon := true;
  1343.         end;
  1344.       end;
  1345.  
  1346.       if Auto_CON and (MldOk in [1,2,3,6]) then
  1347.       begin
  1348.         Auto_CON := false;
  1349.         InfoOut(show,1,1,InfoZeile(119) + B1 + int_str(Kanal) + DP + B1 + InfoZeile(154));
  1350.       end;
  1351.     end;
  1352.  
  1353.     if ((NodeCmd and not Ignore) or Auto_CON) and (MldOk in [6,7]) then
  1354.     begin
  1355.       if Rekon and (LogArt = 2) then LogBuchEintrag(Kanal,0);
  1356.       MemZeile := UpCaseStr(MemZeile);
  1357.       KillEndBlanks(MemZeile);
  1358.       NodeCmd := false;
  1359.       NodeCon := true;
  1360.  
  1361.       While pos(B1,MemZeile) > 0 do MemZeile := RestStr(MemZeile);
  1362.       if pos(DP,MemZeile) > 0 then MemZeile := ParmStr(2,DP,MemZeile);
  1363.  
  1364.       Flag := Auto_CON;
  1365.       L_ON(Kanal,TncConStr + B1+ MemZeile,false,Rekon);
  1366.       Bstr := MemZeile;
  1367.       if (morsen or Speek) and not Flag then
  1368.       begin
  1369.         Rufz := Bstr;
  1370.         Strip(Bstr);
  1371.  
  1372.         if morsen and ((ReKon and ReconMorsen) or (not ReKon and ConMorsen)) then
  1373.         begin
  1374.           Verzoegern(10 * MPause);
  1375.           Morse(Kanal,Bstr);
  1376.         end;
  1377.  
  1378.         if Speek and ((ReKon and ReconVoice) or (not ReKon and ConVoice))
  1379.          then Sprechen(Rufz);
  1380.  
  1381.         ReKon := false;
  1382.       end;
  1383.       if AusstiegsKanal and not K[GegenKanal]^.RemConReady
  1384.           and not Auto_CON then K[GegenKanal]^.RemConReady := true;
  1385.     end;
  1386.  
  1387.     if not Ignore then
  1388.     begin
  1389.       if SysopParm then Password_Auswert(Kanal,Zeile);
  1390.       if Priv_Modus then  (*  //priv wurde bereits empfangen. Jetzt die  *)
  1391.       begin               (*  Antwort auswerten                          *)
  1392.         Priv_Modus := false;
  1393.         if pos(Priv_Errechnet,copy(Zeile,1,80)) > 0 then RemAll := true;
  1394.         SetzeFlags(Kanal);
  1395.       end;
  1396.     end;
  1397.  
  1398.     if Kopieren > 0 then S_PAC(Kopieren,NU,FrEnd,Zeile);
  1399.  
  1400.     if EinstiegsKanal or (AusstiegsKanal and not FoundCall) then
  1401.     begin
  1402.       K[GegenKanal]^.WishBuf := true;
  1403.       S_PAC(GegenKanal,NU,FrEnd,Zeile);
  1404.     end;
  1405.  
  1406.     if SCon[0] and (MldOk = 13) and (length(MemZeile) > 2) and TNC_ReadOut
  1407.        and not (Ignore or Mo.MonActive or Conv.Active or SplSave) then
  1408.     begin
  1409.       Flag := Call_Exist(Kanal,2,'');
  1410.       if Auto and not Flag then
  1411.       begin
  1412.         if FileSend then FertigSenden(Kanal);
  1413.         RemFlag := Echo in [4..7];
  1414.         if RemAll then i1 := 2
  1415.                   else i1 := 1;
  1416.         delete(MemZeile,1,2);
  1417.         KillEndBlanks(MemZeile);
  1418.         if (length(MemZeile) = 0) then unknown := true else
  1419.         begin
  1420.           i := REM_Auswert(Kanal,i1,MemZeile);
  1421.           if (Einstiegskanal and (i = 1)) or not Einstiegskanal
  1422.            then Remote(Kanal,i,MemZeile);
  1423.           if unknown then
  1424.           begin
  1425.             val(CutStr(MemZeile),i,i1);
  1426.             if (i1 = 0) and (i in [0..maxLink]) then
  1427.             begin
  1428.               unknown := false;
  1429.               if i = 0 then SendToChannel(Kanal,0,1,maxLink,MemZeile)
  1430.                        else SendToChannel(Kanal,0,i,i,MemZeile);
  1431.             end;
  1432.           end;
  1433.         end;
  1434.         MemZeile := B1 + DpS + UpCaseStr(MemZeile);
  1435.         if unknown then S_PAC(Kanal,NU,false,InfoZeile(112) + MemZeile + M1);
  1436.         if notRC then
  1437.         begin
  1438.           S_PAC(Kanal,NU,false,InfoZeile(129) + MemZeile + M1);
  1439.           _aus(Attrib[20],Kanal,InfoZeile(300) + M1);
  1440.         end;
  1441.         if ParmWrong then S_PAC(Kanal,NU,false,InfoZeile(174) + MemZeile + M1);
  1442.         if unknown or notRC or ParmWrong then Send_Prompt(Kanal,FF);
  1443.         unknown := false;
  1444.         notRC := false;
  1445.         ParmWrong := false;
  1446.         RemFlag := false;
  1447.       end else
  1448.       begin
  1449.         if not (EinstiegsKanal or AusstiegsKanal or FileSend)
  1450.           then S_PAC(Kanal,NU,true,InfoZeile(120) + M1);
  1451.         if Flag and Auto then _aus(Attrib[20],Kanal,InfoZeile(300) + M1);
  1452.       end;
  1453.     end;
  1454.  
  1455.     if FileSend and (TX_Bin = 2) then
  1456.     Begin
  1457.       if MldOk in [6,10] then
  1458.       begin
  1459.         FiResult := CloseBin(TxFile);
  1460.         FileSend := false;
  1461.         SetzeFlags(Kanal);
  1462.         if MldOk = 10 then S_PAC(Kanal,NU,true,M1 + InfoZeile(107) + M1);
  1463.       end;
  1464.       if MldOk = 9 then TX_Bin := 3;   { #OK# }
  1465.     End;
  1466.  
  1467.     if MldOk in [19,20,21,22] then Compress_Ein_Aus(Kanal);
  1468.   end;
  1469. End;
  1470.  
  1471.  
  1472. Function FreiePuffer (* Kanal : Byte) : Word *);
  1473. Begin
  1474.   with K[Kanal]^ do
  1475.   begin
  1476.     Ausgabe := false;
  1477.     TxRxTNC(Kanal,1,'@B');
  1478.     FreiePuffer := Word(str_int(Response));
  1479.   end;
  1480. End;
  1481.  
  1482. Function  QuerCheck (* Zeile : String) : Word *);
  1483. Var  i,l : Byte;
  1484.      w : Word;
  1485. Begin
  1486.   l := ord(Zeile[0]);
  1487.   w := l;
  1488.   for i := 1 to l do w := w + ord(Zeile[i]);
  1489.   QuerCheck := w;
  1490. End;
  1491.  
  1492.  
  1493. Procedure Mon_Header_Auswerten;
  1494. Var  i,i1,i2,
  1495.      iz,iNr,
  1496.      fNr       : Byte;
  1497.      FehlFrame,
  1498.      IFr,UFr   : Boolean;
  1499.      Hstr      : String[25];
  1500.      Bstr      : String[80];
  1501.      Fstr      : String[50];
  1502. Begin
  1503.   if Mon_Anz > 0 then
  1504.   begin
  1505.     iNr := pos(IFrame,G^.HeaderStr);
  1506.     IFr := iNr > 0;
  1507.     if IFr then
  1508.     begin
  1509.       iNr := pos(IFrame,G^.HeaderStr) + 7;
  1510.       iNr := str_int(G^.HeaderStr[iNr]);
  1511.     end;
  1512.     UFr := pos(UFrame,G^.HeaderStr) > 0;
  1513.     Hstr := ParmStr(2,B1,G^.HeaderStr) + zu +
  1514.             ParmStr(4,B1,G^.HeaderStr) + B1;
  1515.  
  1516.     for i := 1 to maxLink do with K[i]^ do
  1517.     begin
  1518.       if Mo.MonActive then
  1519.       begin
  1520.         for i1 := 1 to 2 do Mo.MonNow[i1] := false;
  1521.         if Mo.MonBeide then iz := 2 else iz := 1;
  1522.         for i1 := 1 to iz do
  1523.         begin
  1524.           if pos(Mo.MonStr[i1]+B1,Hstr) > 0 then
  1525.           begin
  1526.             if Mo.MonFirst[i1] then Mo.MonFrameNr[i1] := iNr;
  1527.  
  1528.             FehlFrame := Mo.MonIFr and IFr and Mo.MonStrict and
  1529.                            (iNr <> Mo.MonFrameNr[i1]) and
  1530.                            (QuerCheck(K[0]^.Response) <> Mo.MonCtrl[i1][iNr]);
  1531.  
  1532.             if (Mo.MonUFr and UFr) or FehlFrame or
  1533.                (Mo.MonIFr and IFr and
  1534.                (not Mo.MonStrict or (iNr = Mo.MonFrameNr[i1]))) then
  1535.             begin
  1536.               Mo.MonCtrl[i1][iNr] := QuerCheck(K[0]^.Response);
  1537.  
  1538.               if FehlFrame then
  1539.               begin
  1540.                 fNr := Mo.MonFrameNr[i1];
  1541.                 Mo.MonFrameNr[i1] := iNr;
  1542.                 Fstr := B1 + InfoZeile(170);
  1543.                 While fNr <> iNr do
  1544.                 begin
  1545.                   Fstr := Fstr + B1 + 'I' + int_str(fNr);
  1546.                   inc(fNr);
  1547.                   if fNr > 7 then fNr := 0;
  1548.                 end;
  1549.               end;
  1550.  
  1551.               inc(Mo.MonFrameNr[i1]);
  1552.               if Mo.MonFrameNr[i1] > 7 then Mo.MonFrameNr[i1] := 0;
  1553.  
  1554.               if (Hstr <> Mo.MonLast) or FehlFrame then
  1555.               begin
  1556.                 if not RxLRet then _aus(Mo.MonAttr,i,M1);
  1557.                 if Mo.MonHCall then
  1558.                 begin
  1559.                   Bstr := Hstr;
  1560.                   KillEndBlanks(Bstr);
  1561.                   if not Mo.MonEHCall then Bstr := CutStr(Bstr);
  1562.                   Bstr := LSK + Bstr + RSK + DP;
  1563.                   if IFr then Bstr := Bstr + B1 + LRK + 'I' + int_str(iNr) + RRK;
  1564.                   if FehlFrame then
  1565.                   begin
  1566.                     Bstr[1] := S_ch;
  1567.                     Bstr := Bstr + Fstr;
  1568.                   end;
  1569.                   _aus(Attrib[19],i,Bstr + M1);
  1570.                 end;
  1571.               end;
  1572.  
  1573.               Mo.MonAttr := Attrib[25+i1];
  1574.               Mo.MonLast := Hstr;
  1575.               Mo.MonNow[i1] := true;
  1576.             end;
  1577.             Mo.MonFirst[i1] := false;
  1578.           end;
  1579.         end;
  1580.       end;
  1581.     end;
  1582.   end;
  1583. End;
  1584.  
  1585.  
  1586. Procedure TickerOut;
  1587. Var    i,i1,Attr : Byte;
  1588. Begin
  1589.   if TicAnz > 0 then
  1590.   begin
  1591.     i1 := 0;
  1592.     for i := 1 to Tnc_Anzahl do with TNC[i]^ do if Tic then
  1593.     begin
  1594.       inc(i1);
  1595.       Attr := Attrib[ColMonBeg + i * 3];
  1596.       WriteRam(1,i1,Attr,1,int_str(i) + DP + B1 + TicStr);
  1597.     end;
  1598.   end;
  1599. End;
  1600.  
  1601.  
  1602. Function  FormMonFr (* TNr : Byte; Hstr : Str5; Zeile : String) : String *);
  1603. Var    i : Byte;
  1604. Begin
  1605.   if ModMonFr then
  1606.   begin
  1607.     delete(Zeile,1,3);
  1608.     i := pos(B1+'to'+B1,Zeile);
  1609.     Zeile[i] := RSK;
  1610.     delete(Zeile,i+1,3);
  1611.  
  1612.     i := pos(B1+'via'+B1,Zeile);
  1613.     if i > 0 then delete(Zeile,i,4);
  1614.  
  1615.     i := pos(B1+'ctl'+B1,Zeile);
  1616.     if i > 0 then delete(Zeile,i,4);
  1617.  
  1618.     i := pos(B1+'pid'+B1,Zeile);
  1619.     if i > 0 then delete(Zeile,i,4);
  1620.   end;
  1621.   if MonID = 1 then Zeile := Hstr + Zeile;
  1622.   if MonID = 2 then Zeile := int_str(TNr) + DP + Zeile;
  1623.   FormMonFr := Zeile;
  1624. End;
  1625.